module.exports = function($scope, $state, $stateParams,$resource,$modal){
             $scope.searchform = {};
                $scope.maxSize = 5;             //最多显示多少个按钮
                $scope.currentPage = 1;      //当前页码
                $scope.itemsPerPage = 10        //每页显示几条



    $scope.pageChanged = function () {
           var para = {
            //    ta:1,
                pageNo:$scope.currentPage,
                pageSize:$scope.itemsPerPage,
            
            };
            para = angular.extend($scope.searchform, para);
            $resource('/api/ac/ggc/equipmentBacklogService/findWeiBanList', {}, {}).
            save(para, function(res){
                    if(res.errcode === 0 || res.errcode === 10003){
                            $scope.infolist={};
                            $scope.infolist=res.data.results;
                            $scope.totalItems = res.data.totalRecord;

                            if($scope.totalItems>0){
                               for(var i=0;i<res.data.results.length;i++){
                                        
                                            res.data.results[i].shixiang=res.data.results[i].cname+'的'+res.data.results[i].sbname+'未检验';

                                        
   
                                    }
                            }
                          
                         
                          
                    }else{
                        alert(res.errmsg);
                    }
                });

        };
        $scope.pageChanged();


           $scope.searchform1 = {};
                $scope.maxSize = 5;             //最多显示多少个按钮
                $scope.currentPage1 = 1;      //当前页码
                $scope.itemsPerPage1 = 10        //每页显示几条



    $scope.pageChanged1 = function () {
           var para = {
            //    ta:1,
                pageNo:$scope.currentPage1,
                pageSize:$scope.itemsPerPage1,
            
            };
            para = angular.extend($scope.searchform1, para);
            $resource('/api/ac/ggc/equipmentBacklogService/findWanChengList', {}, {}).
            save(para, function(res){
                    if(res.errcode === 0 || res.errcode === 10003){
                            $scope.objlist={};
                            $scope.objlist=res.data.results;
                            $scope.totalItems1 = res.data.totalRecord;
                         
                          
                    }else{
                        alert(res.errmsg);
                    }
                });

        };
        $scope.pageChanged1();
	   		 
        $scope.lianxi=function(item){
             if(confirm('请最后确认是否完成了电话沟通任务！')){


                $resource('/api/ac/ggc/equipmentBacklogService/updateDaiBanState', {}, {}).
                save({'id':item.id,'shixiang':item.shixiang}, function(res){
                        if(res.errcode === 0 || res.errcode === 10003){
                                alert('办理成功');
                                 $state.go('app.equipmentBacklog',{},{reload: true});
                              
                        }else{
                            alert(res.errmsg);
                        }
                });
          }
        }
//              $scope.date1 = {	            
// 			                'opened': false
// 			            }


//              $scope.dateOpen1 = function ($event, item) {
//                 $event.preventDefault();
//                 $event.stopPropagation();
//                 item.opened = true;
//             };
//             $scope.date = {	            
// 		                'opened': false
// 		            }


//              $scope.dateOpen = function ($event, item) {
//                 $event.preventDefault();
//                 $event.stopPropagation();
//                 item.opened = true;
//             };


//        		function date2str2(d) {
//                 if (d === undefined) {
//                     return "";
//                 }
//                 var month = (d.getMonth() + 1).toString();
//                 var day = d.getDate().toString();
//                 if (month.length == 1) month = '0' + month;
//                 if (day.length == 1) day = '0' + day;
//                 return d.getFullYear() + "-" + month + "-" + day;
//             }

           
// // ----
          
//            $scope.date2 = {	            
// 			                'opened': false
// 			            }


//              $scope.dateOpen2 = function ($event, item) {
//                 $event.preventDefault();
//                 $event.stopPropagation();
//                 item.opened = true;
//             };
//             $scope.date3 = {	            
// 		                'opened': false
// 		            }


//              $scope.dateOpen3 = function ($event, item) {
//                 $event.preventDefault();
//                 $event.stopPropagation();
//                 item.opened = true;
//             };



}